<template>
    <div class="cbox">
        <h4>子组件B</h4>
        <p>msg:{{ msg }}</p>
        <input type="text" v-model="msg">
    </div>
</template>

<script setup>
import { computed } from "@vue/reactivity";
import { useStore } from "vuex";

const $store = useStore();

// let msg = computed(()=>$store.state.msg)
let msg = computed({
    get(){
        return $store.state.msg
    },
    set(nv){
        $store.commit("setMsg",nv)
    }
})


</script>

<style lang="sass" scoped>

</style>